package com.itheima.mapper;

import com.itheima.common.dto.OrderDto;
import com.itheima.pojo.Order;
import com.itheima.pojo.OrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

@Mapper
public interface OrderMapper {

    //查询是否有同一个用户在同一天预约了同一个套餐的预约信息
    Integer findByMemberIdAndSetmealId(OrderDto orderDto);

    OrderVo findOrderById(Integer id);

    void insert(Order order);

    OrderVo getOrderAndVisitsNumber(Date startDate, Date endDate);

    @Select("select count(id) from `order`")
    Integer getTotal();

    @Select("select count(id) from `order` where order_date = #{date}")
    OrderVo getTotalOrderAndVisitsNumber(Date date);
}
